#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void Swap(char* a, char* b, int width)
{
	int i = 0;
	for (i = 0; i < width; i++)
	{
		char tem = *a;
		*a = *b;
		*b = tem;
		a++;
		b++;
	}

}

int cmp(const void* a, const void* b)
{
	return *(int*)a - *(int*)b;
}
void my_qsort(void* base, size_t sz, size_t width, int (*cmp)(const void* a, const void* b))
{
	int i = 0;
	for (i = 0; i < sz - 1; i++)
	{
		int j = 0;
		for (j = 0; j < sz - 1 - i; j++)
		{
			if ((*cmp)((char*)base + j * width, (char*)base + (j + 1) * width) > 0)
			{
				Swap((char*)base + j * width, (char*)base + (j + 1) * width, width);
			}
		}
	}
}
int main()
{
	int arr[5] = { 432,45,46453,45,64 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	my_qsort(arr, sz, sizeof(arr[0]), cmp);
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}